export interface AppConfig {
  title: string;
  theme: Theme;
  layout: Layout;
  templates: Templates;
  gisAPI: string;
  map: Map;
  widgetPool: WidgetPool;
  widgetsOnMap: WidgetsOnMap;
  widgetsOnScreen: WidgetsOnScreen;
}

export interface Layout {
}

export interface Map {
  '3D': boolean;
  '2D': boolean;
  position: MapPosition;
  layers: Layers;
  options: MapOptions;
  id: string;
}

export interface Layers {
  baseLayer: BaseLayer[];
  operationalLayers: OperationalLayer[];
}

export interface BaseLayer {
  url: string;
  layerId: string;
  layerName?: string;
  defaultMap?: boolean;
  options?: BaseMapOptions;
  token?: Token;
}

export interface BaseMapOptions {
  minZoom: number;
  maxZoom: number;
}

export interface Token {
  tokenField: string;
  tokenValue: string;
}

export interface OperationalLayer {
  url: string;
  layerId: string;
  layerName?: string;
  visibility?: boolean;
}

export interface MapOptions {
  extent?: Extent;
  spatialReference?: SpatialReference;
  logo?: boolean;
  center?: number[];
  zoom?: number;
}

export interface Extent {
  type: string;
  xmin: number;
  ymin: number;
  xmax: number;
  ymax: number;
}

export interface SpatialReference {
  wkid: number;
}

export interface MapPosition {
  left?: number;
  top?: number;
  right?: number;
  bottom?: number;
}

export interface Templates {
  header: Header;
  content: Layout;
  footer: Layout;
}

export interface Header {
  id: string;
  name: string;
  title: string;
}

export interface Theme {
  name: string;
  styles: string[];
}

export interface WidgetPool {
  widgets: WidgetPoolWidget[];
  layouts:WidgetPoolLayout[];
}

export interface WidgetPoolWidget {
  id: string;
  name: string;
  title?: string;
  layout?: string;
  group?: Widget[];
}

export interface WidgetPoolLayout{
  id: string;
  name: string;
  path?: string;
  position?: ElePosition;
}

export interface Widget {
  id: string;
  name: string;
  title?: string;
  path?: string;
  position?: ElePosition;
  isDup?: boolean;
  group?: Widget[];
}

export interface ElePosition {
  left?:string;
  right?: string;
  top?: string;
  bottom?:string;
}

export interface WidgetsOnMap {
  widgets: WidgetsOnMapWidget[];
}

export interface WidgetsOnMapWidget {
  id: string;
  name: string;
  title: string;
  uri: string;
  position: MapPosition;
}

export interface WidgetsOnScreen {
  widgets: WidgetsOnScreenWidget[];
}

export interface WidgetsOnScreenWidget {
  id: string;
  name: string;
  uri: string;
}
